package Dao;

import Utils.C3P0Utils;
import domain.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by Administrator on 2017/10/19.
 */
public class productImpl implements Product{
    @Override
    public List<User> findAll() {
        QueryRunner runner=new QueryRunner(C3P0Utils.getDs());
        String sql="select * from product";
        List list=null;
        try {
            list=(List) runner.query(sql,new BeanListHandler(User.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }
}
